﻿using Bll;
using Dal;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using Model;
using System.Runtime.InteropServices;

namespace yue.Apl.Controllers
{
    [Route("api/[controller]/[action]")]
    [ApiController]
    public class jgController : ControllerBase
    {
        public jgController(jgbll jgbll)
        {
            Jgbll = jgbll;
        }

        public jgbll Jgbll { get; }
        [HttpPost]
        public int xadd(Xiamodel xiamodel)
        {
            return Jgbll.xadd(xiamodel);
        }
        [HttpGet]
        public List<Xiamodel> xshow()
        {
            return Jgbll.xshow();
        }
        [HttpPost]
        public int jadd(jgmodel jgmodels)
        {
            return Jgbll.jadd(jgmodels);
        }
        [HttpGet]
        public IActionResult jshow(int pageindex = 1, int pagesize = 2, string? Jgname = "", int? xialaid = null)
        {
            var tcount = 0;
            var tpage = 0;
            var list= Jgbll.jshow(out tcount, out tpage, pageindex, pagesize, Jgname, xialaid);
            return Ok(new
            {
                tcount = tcount,
                tpage = tpage,
                list = list
            });
        }
        [HttpDelete]
        public int deleted(string id)
        {
            return Jgbll.deleted(id);
        }
        [HttpGet]
        public jgmodel fantian(int id)
        {
            return Jgbll.fantian(id);
        }
        [HttpPut]
        public int xiugai(jgmodel jgmodels)
        {
            return Jgbll.xiugai(jgmodels);
        }
        [HttpPut]
        public int xiugz(string id, int steat)
        {
            return Jgbll.xiugz(id, steat);
        }
    }
}
